FROM devcloud-cn-north-1.jcr.service.jdcloud.com/inscode:mysql57 as app

#安装语言环境
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata x11vnc xvfb
RUN apt-get -y install openjdk-8-jre openjdk-8-jdk openjdk-17-jre openjdk-17-jdk curl unzip tar
# Install Maven
#ARG MAVEN_VERSION=3.8.8
#ARG MAVEN_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
COPY apache-maven-3.8.8-bin.tar.gz /tmp/apache-maven.tar.gz
#RUN curl -fsSL ${MAVEN_URL} -o /tmp/apache-maven.tar.gz \
RUN tar -xzf /tmp/apache-maven.tar.gz -C /opt \
  && ln -s /opt/apache-maven-${MAVEN_VERSION} /opt/maven \
  && rm /tmp/apache-maven.tar.gz
ENV PATH="/opt/maven/bin:${PATH}"

# Install Gradle
#ARG GRADLE_VERSION=7.3.3
#ARG GRADLE_URL=https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip
COPY gradle-7.3.3-bin.zip /tmp/gradle.zip
#RUN curl -fsSL ${GRADLE_URL} -o /tmp/gradle.zip \
RUN unzip /tmp/gradle.zip -d /opt \
  && ln -s /opt/gradle-${GRADLE_VERSION} /opt/gradle \
  && rm /tmp/gradle.zip
ENV PATH="/opt/gradle/bin:${PATH}"

RUN echo 'export PATH="/opt/maven/bin:/opt/gradle/bin:$PATH"' >> /etc/profile
EXPOSE 8000

CMD [ "/bin/bash","-c", "/root/.init.sh" ]
